<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>分页界面</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css"/>
</head>
<body>
<div class="wrap-container clearfix">
    <div class="column-content-detail">
        <form class="layui-form">
            <div class="search-cont clearfix" id="tool">
                <div class="operation-btn-cont">
                    <div class="operright cyt-retract-close hideMenu"> 收起筛选<i class="iconfont">&#xe658;</i></div>
                    <div class="operright cyt-retract-open showMenu" style="display: none;"> 展开筛选<i class="iconfont">&#xe936;</i></div>
                    <!--button开始-->
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="addBtn"><i class="iconfont marr5">&#xe65e;</i>添加</button>
                    <!--button结束-->
                    <div class="triangle-bottom"></div>
                    <div class="triangle-top"></div>
                </div>
                <div class="search-details">
                    <div class="layui-form-item marb5">
                        <!--search开始-->
                        <div class="layui-inline">
                            <label class="layui-form-label">应用名称：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="name" placeholder="请输入应用名称" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">状态类型：</label>
                            <div class="layui-input-inline">
                                <select name="status" id="status"></select>
                            </div>
                        </div>
                        <!--search结束-->
                        <div class="layui-inline marl8">
                            <button class="layui-btn layui-btn-normal" type="button" lay-submit="" lay-filter="seacherBtn">搜索</button>
                            <button class="layui-btn layui-btn-normal" type="reset">重置</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <div class="layui-form" id="table-list">
            <table id="entityList" lay-filter="entityList" class="cy-list-table"></table>
        </div>
    </div>
</div>
<!--操作-->
<script type="text/html" id="entityBar">
    <a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-green" lay-event="edit">编辑</a>
    <button type="button" class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-red" lay-event="menu">菜单</button>
</script>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    var tableIns = null;
    layui.use(['jquery', 'table', 'page', 'fileUtil'], function () {
        var $ = layui.jquery,
            page = layui.page,
            table = layui.table,
            fileUtil = layui.fileUtil;

        //获取分页数据
        page.initDict('wx_apply_use_type,base_status,wx_apply_use_status', function (dictData) {
            page.showDict($("#status"), page.aceeptDictContentList(dictData, 'base_status'), "全部");
            var url = "/wx/wxapplyuse/page";
            var cols = [
                {type: 'checkbox', fixed: 'left'},
                {field: 'name', title: '应用名称', align: 'center'},
                {
                    field: 'coverImage', title: '应用封面', align: 'center', width: 100, templet: function (d) {
                        if (isBlank(d.coverImage)) {
                            return "";
                        } else {
                            return "<img  lay-event='show' src='/sysFile/showFileByObjectId?objectId=" + d.coverImage + "' style='width: 30px;height: 30px;'/>";
                        }
                    }
                },
                {field: 'webPath', title: '后台地址', align: 'center'},
                {field: 'phonePath', title: '手机端地址', align: 'center'},
                {field: 'money', title: '费用元/年', align: 'center', width: 100},
                {field: 'useDay', title: '试用期/天', align: 'center', width: 100},
                {
                    field: 'type', title: '应用类型', align: 'center', templet: function (d) {
                        return page.aceeptDictContentName(dictData, 'wx_apply_use_type', d.type);
                    }
                },
                {
                    field: 'applyUseStatus', title: '应用状态', align: 'center', templet: function (d) {
                    return page.aceeptDictContentName(dictData, 'wx_apply_use_status', d.applyUseStatus);
                }
                },
                {
                    field: 'status', title: '状态', align: 'center', width: 100, templet: function (d) {
                        return page.aceeptDictContentName(dictData, 'base_status', d.status);
                    }
                },
                {field: 'version', title: '版本号', align: 'center', width: 100},
                {
                    field: 'createTime', title: '创建时间', width: 170, align: 'center', templet: function (d) {
                        return new Date(d.createTime).Format("yyyy-MM-dd hh:mm:ss");
                    }
                },
                {title: '操作', width: 170, templet: '#entityBar', align: "center"}
            ];
            tableIns = page.initDate(cols, url);
        });

        //监听行工具事件
        table.on('tool(entityList)', function (obj) {
            var layEvent = obj.event,
                data = obj.data;
            if (layEvent === 'edit') {
                page.editPopup('/wx/wxapplyuse/getEdit?id=' + data.id, '编辑');
            } else if (layEvent === 'show') {
                fileUtil.imageSingleByObjectIdShow(data.coverImage);
            } else if (layEvent === 'menu') {
                page.edit(data.id, "/wx/wxapplymenu/wxApplyMenuList?applyUseId=" + data.id, data.name + "菜单");
            }
        });

        //监听添加按钮事件
        $('#addBtn').bind('click', function () {
            page.editPopup('/wx/wxapplyuse/getEdit', '添加');
        });
    });
</script>
</body>
</html>